class Word extends eui.Component implements  eui.UIComponent {
	
	public lab_word:eui.Label;

	public constructor() {
		super();
	}

	protected partAdded(partName:string,instance:any):void
	{
		super.partAdded(partName,instance);
	}


	protected childrenCreated():void
	{
		super.childrenCreated();
		this.init();
	}
	private init(){
		this.lab_word.addEventListener(egret.TouchEvent.TOUCH_TAP,this.onClickWord,this);
	}
	public onClickWord(){
		SceneGame.getInstance().onTabSelectWord(this);
	}
	public setWordText(val:string){
		this.lab_word.text=val;
	} 
	//获取文本内容
	public getWordText():string{
		return this.lab_word.text;
	}
}
class AnswerWord extends Word {

	public select_word:Word=null;

 	public constructor() {
		super();
	}

	protected partAdded(partName:string,instance:any):void
	{
		super.partAdded(partName,instance);
	}


	protected childrenCreated():void
	{
		super.childrenCreated();
	}
	//重写点击事件
	public onClickWord(){
		SoundManager.getInstance().playClick();
		//如果点击的答案区域有文字内容
		if(this.select_word){
			this.setWordText("");
			this.select_word.visible=true;
			this.select_word=null;
		}
	}
	public setSelectWord(w:Word){
		if(w){
			this.setWordText(w.getWordText())
		}else{
			this.setWordText("");
		}
		this.select_word=w;
	}
}